namespace FunctionalProgramming.PatternMatching.TransformingRules
{
   internal class ConstantInputOutput<TIn, TOut> : ITransformingRule<TIn, TOut>
   {
      private readonly TIn matchingConstant;
      private readonly TOut outputConstant;

      public ConstantInputOutput(TIn matchingConstant, TOut outputConstant)
      {
         this.matchingConstant = matchingConstant;
         this.outputConstant = outputConstant;
      }

      public bool DoesInputMatch(TIn input)
      {
         bool result = matchingConstant.Equals(input);
         return result;
      }

      public TOut TransformInput(TIn input)
      {
         return outputConstant;
      }
   }
}